import { reactive, ref } from "vue";

export default function InitHook() {
  const activeKey = ref<string>("-1");
  const tableRef = ref<any>(null);
  const pageStat = ref<Base.GeneraDataType>({
    "-1": 0,
    3: 0,
    4: 0
  });
  const searchForm = reactive<Partial<StockManagement.SearchForm>>({
    companyIdList: [],
    preOrderNoList: undefined,
    waybillNumList: undefined,
    fbaNumberList: undefined,
    bizIdList: undefined,
    storageBy: undefined,
    shortName: undefined,
    makeInvoiceStatus: undefined,
    shippingMethod: undefined,
    driverUserIdList: [],
    orderTimeList: [],
    expectedPickupTimeList: [],
    channelIdList: [],
    customerIdList: [],
    warehouseCodeList: [],
    pushOrderSuccess: "",
    pageNum: 1,
    pageSize: 50,
    total: 0
  });
  const tableData = ref<Array<StockManagement.ListRows>>([]);
  const drawerOpts = reactive<Base.DrawerOpts>({
    title: "",
    width: "520px",
    component: "",
    visible: false,
    type: 1,
    passData: {}
  });
  const dialogOpts = reactive<Base.DialogOpts>({
    title: "",
    width: "520px",
    component: "",
    visible: false,
    type: 1,
    passData: {}
  });
  const getPopupContainer = () => document.querySelector(".nav-header-page");
  return {
    searchForm,
    tableData,
    drawerOpts,
    activeKey,
    pageStat,
    tableRef,
    dialogOpts,
    getPopupContainer
  };
}
